package study.mybatis.mapper.orderbase;

import io.vavr.Tuple2;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.mapping.ResultSetType;
import org.apache.ibatis.session.ResultHandler;
import study.mybatis.mapper.BaseMapper;

import java.util.List;
import java.util.Map;

public interface OrderBaseMapper extends BaseMapper<Long, OrderBaseEO> {

    List<OrderBaseEO> getOrderLt(Long pfId);

    /**
     * （1）基于 mybatis 的游标规则，类似于 oracle 的 fetch size 缓冲区
     * （2）基于 cursor 构建的方式
     * sqlSession.getMapper(PopedomFunctionMapper.class).scan()
     */
    @ResultType(OrderBaseEO.class)
    @Options(resultSetType = ResultSetType.FORWARD_ONLY, fetchSize = 2)
    void getOrderLtByCursor(ResultHandler<OrderBaseEO> handler, Long pfId);

    /**
     * 返回值 Integer Long Double String
     */
    Double getCount();

    List<String> getAmountList();

    String getAmount();

    List<Tuple2> getTuple2();

    List<Map> getMap();
}
